package com.yilijk.base.network.core;

import java.util.HashMap;
import java.util.Map;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * Created by SHICHENG
 * <p>
 * Time on 2022/03/07
 */
public interface NetWorkService {

    @POST("{methodName}")
    Call<ResponseBody> post(@Path(value = "methodName", encoded = true) String methodName, @Body RequestBody body);

    @GET("{methodName}")
    Call<ResponseBody> get(@Path(value = "methodName", encoded = true) String methodName, @QueryMap HashMap<String, Object> datamap);

    @PUT("{methodName}")
    Call<ResponseBody> put(@Path(value = "methodName", encoded = true) String methodName, @Body RequestBody body);

    @DELETE("{methodName}")
    Call<ResponseBody> delete(@Path(value = "methodName", encoded = true) String methodName, @QueryMap HashMap<String, Object> body);

    //上传文件
    @Multipart
    @POST("{methodName}")
    Call<ResponseBody> upLoadFile(@Path(value = "methodName", encoded = true) String methodName, @PartMap Map<String, RequestBody> params, @Part MultipartBody.Part parts);

    //上传图片
    @Multipart
    @POST("{methodName}")
    Call<ResponseBody> upLoadImg(@Path(value = "methodName",encoded = true) String methodName, @Part MultipartBody.Part parts);
    //带参上传图片
    @Multipart
    @POST("{methodName}")
    Call<ResponseBody> upLoadImg(@Path(value = "methodName",encoded = true) String methodName,
                                 @Part("policy") RequestBody policy,
                                 @Part("OSSAccessKeyId") RequestBody OSSAccessKeyId,
                                 @Part("signature") RequestBody signature,
                                 @Part("key") RequestBody key,
                                 @Part("success_action_status") RequestBody success_action_status,
                                 @Part MultipartBody.Part parts);

    //上传mp3
    @Multipart
    @POST("{methodName}")
    Call<ResponseBody> upLoadMP3(@Path(value = "methodName",encoded = true) String methodName, @Part MultipartBody.Part parts);

    //带参上传mp3
    @Multipart
    @POST("{methodName}")
    Call<ResponseBody> upLoadMP3(@Path(value = "methodName",encoded = true) String methodName,
                                 @Part("policy") RequestBody policy,
                                 @Part("OSSAccessKeyId") RequestBody OSSAccessKeyId,
                                 @Part("signature") RequestBody signature,
                                 @Part("key") RequestBody key,
                                 @Part("success_action_status") RequestBody success_action_status,
                                 @Part MultipartBody.Part parts);

    @Streaming
    @GET
    Call<ResponseBody> download(@Url String url);

}
